﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace LoQui.SharedClasses
{
    public class Validation
    {
        private Boolean varibaleIsNumeric(String textbox)
        {
            int number = 0;
            try
            {
                number = Convert.ToInt32(textbox);
                return true;
            }
            catch (Exception ex)
            {
                Console.Write("Exception is: " + ex);
            }
            return false; ;
        }

        public Boolean variableIsSecureFromMalawareCode(string malwareCode,int size) { 
            if(malwareCode!=null){
			if(malwareCode.Length>size){
				return false;
			}
			String allowed="1234567890qwertyuiopåasdfghjklöäzxcvbnmQWERTYUIOPÅASDFGHJKLÖÄZXCVBNM.@ ,?!-:()\r\n";
			int counter=0;
			for(int i=0;i<malwareCode.Length;i++){
				for(int j=0;j<allowed.Length;j++){
					if(malwareCode[i]==allowed[i]){
						counter++;
						j=allowed.Length+1;
					}
				}
			}
			if(malwareCode.Length==counter){
				return true;
			}
		}
		Console.Write("variableSecureFromMalwareCode(string "+malwareCode+",int "+size+")");
		return false;
        }




    }


}